package orgs.example.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import orgs.example.pojo.Cancellation;
import orgs.example.pojo.MeetingRoom;
import orgs.example.pojo.Reservation;

import java.util.Date;
import java.util.List;

@Mapper
public interface StaffMapper {

//    查找取消订单表
    @Select("select * from cancellation")
    List<Cancellation> searchAllCancellation();

//    根据订单号找订单
    @Select("select * from reservation where reserve_id=#{reserveId}")
    Reservation searchReserveByreserveId(Integer reserveId);

//  找所有订单
    @Select("select * from reservation")
    List<Reservation> searchAllReservation();

//  更改房间状态
    @Update("update meeting_room set room_status=#{status} where room_id=#{roomid} ")
    void changeRoomStatus(Integer roomid, String status);

//  找所有房间
    @Select("select * from meeting_room")
    List<MeetingRoom> searchAllRoom();

//    根据退订订单找退订表
    @Select("select * from cancellation where cancel_id=#{cancelId}")
    Cancellation searchCancellationByCancellationId(Integer cancelId);

//    改变退订订单的状态
    @Update("update cancellation set cancel_status=#{cancelStatus} where cancel_id=#{cancelId}")
    void changCancellationStatus(Integer cancelId, String cancelStatus);

    @Update("update cancellation set cancel_processid=#{id},cancel_processtime=#{now} where cancel_id=#{cancelId}")
    void changCancellationProcessBycancelId(Integer cancelId,Integer id, Date now);
}
